package com.example.dddsample.domain.service;

import com.example.commom.model.PageRows;
import com.example.dddsample.domain.entity.CustomerAggregate;
import com.example.dddsample.domain.repository.CustomerRepository;
import com.example.dddsample.domain.vo.CustomerQueryBaseVO;

import javax.inject.Named;


/**
 * @author: bebm
 * @date: 2022/3/29 14:55
 * @description:
 */
@Named
public class CustomerService {

    private final CustomerRepository customerRepository;

    public CustomerService(CustomerRepository customerRepository){
        this.customerRepository=customerRepository;
    }

    public CustomerAggregate getCustomer(String custId){
        return customerRepository.getCustomerAggregate(custId);
    }

    /**
     *
     * @param customerQueryBaseVO
     * @param pageNum
     * @param pageSize
     * @return PageRows
     */
    public PageRows getPageCustomer(CustomerQueryBaseVO customerQueryBaseVO, int pageNum, int pageSize) {
        return customerRepository.getPageCustomerAggregate(customerQueryBaseVO,pageNum,pageSize);
    }
}
